<?php
/**
 * Groups module for XOOPS
 *
 * You may not change or alter any portion of this comment or credits
 * of supporting developers from this source code or any supporting source code 
 * which is considered copyrighted (c) material of the original comment or credit authors.
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 *
 * @copyright       The Groups Project http://code.google.com/p/groupsforxoops/
 * @license         http://www.fsf.org/copyleft/gpl.html GNU public license
 * @package         groups
 * @since           2.3.0
 * @author          Hui Xiao < xh.8326@gmail.com >
 * @version         $Id: form.post.topic.php Sat Jul 18 13:04:12 CST 2009
 */

if ( !defined("XOOPS_ROOT_PATH") ) exit;

$form = new XoopsForm("", "form", "action.php", "post",true);
$form->setExtra("enctype=\"multipart/form-data\"");

$subject_box = "<input type=\"text\" name=\"post_subject\" size=\"56\" value=\"{$post_obj->getVar("post_subject")}\" />";
$form->addElement( new XoopsFormLabel(_GP_FORM_GROUP_SUBJECT, $column_box.$subject_box,""));

if ( $post_obj->isNew() ) {
    $threads_icon = new XoopsFormRadio(_GP_FORM_GROUP_ICON,"threads_icon");
    $threads_icon->addOption("0",_GP_FORM_GROUP_NOICON);
    foreach ( $icon_rows as $key=>$val ) {
    	$threads_icon->addOption($key,"<img src='images/icon/".$val."' />");
    }
    $form->addElement($threads_icon);
}

$options["editor"] = "dhtmlext";
$form->addElement(new XoopsFormTextArea(_GP_FORM_GROUP_CONTENT,
                                    "post_content",
                                    $post_obj->getVar("post_content"),
                                    15,
                                    50));
	
if ( $post_obj->isNew() ) {
    $form->addElement(new XoopsFormHidden("ac","create"));
    $form->addElement(new XoopsFormHidden("mode",$mode));
} else {
    $form->addElement(new XoopsFormHidden("ac","modify"));
    $form->addElement(new XoopsFormHidden("post_id",$post_id));
    $inStartPage = $posts_handler->getPostInStartPage($tid, $post_id, $xoopsModuleConfig["topicsitems"]);
    if ( $inStartPage > 1 ) {
    	$form->addElement(new XoopsFormHidden("start",($inStartPage-1)*$xoopsModuleConfig["topicsitems"] ));
    }
    $form->addElement(new XoopsFormHidden("tid",$tid));
}
$form->addElement(new XoopsFormHidden("op","post"));
$form->addElement(new XoopsFormHidden("group_id",$group_id));
$form->addElement(new XoopsFormButton("","submit",_SUBMIT,"submit"));
$form->assign($xoopsTpl);
